<template>
  <div class="order-container">
    <h1>订单详情</h1>
    <div class="order-content">
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">申请订单号：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">
            {{ this.showSelected.planCode || "1231231ASDAS" }}
          </div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">订单ID：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">12ASDASD12D</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">客户名称：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">张三</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">客户证件号码：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">12312121412</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">客户等级：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">A</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">申请时间：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">2022-07-09 12:00:00</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">交易平台：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">
            {{ this.showSelected.planName || "1231231ASDAS" }}
          </div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">交易平台编码：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">123asd12e</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">标段名称：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">1231231ASDAS</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">标段编码：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">12ASDASD12D</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">收益企业：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">
            {{ this.showSelected.declareCompany || "***有限公司" }}
          </div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">投标截止日：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">2022-09-08</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">申请产品：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">投标保函</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">经办人：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">李四</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">经办人联系方式：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">13112345678</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">经办人证件号码：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">5105251*****4561378</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">保函编码：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">
            {{ this.showSelected.purchaser || "1231231ASDAS" }}
          </div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">保函校验码：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">12ASDAS</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">保函有效期：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">2022-09-08</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">当前状态：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">审批中</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">申请金额（元）：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">
            {{ this.showSelected.planTotal || "1231231ASDAS" }}
          </div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">应付金额（元）：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">12,000</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">实付金额（元）：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">12,000</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">优惠金额（元）：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">100</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">支付状态：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">支付成功</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">支付方式：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">微信</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">支付时间：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">2022-09-01 12:10:00</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">支付流水号：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">12312312312</div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">审批意见：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">通过</div>
        </el-col>
        <el-col :span="4">
          <div class="grid-lable bg-purple">发票：</div>
        </el-col>
        <el-col :span="8">
          <div class="grid-content bg-purple-light">
            <a href="/imgs/dzfp.jpeg" download>下载电子发票</a
            >&nbsp;&nbsp;&nbsp;&nbsp;
            <!-- <a href="/imgs/hc.jpeg" download>发票红冲</a
            >&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="/imgs/bh.jpeg" download>详情</a> -->
          </div>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="4">
          <div class="grid-lable bg-purple">附件材料：</div>
        </el-col>
        <el-col :span="20">
          <div class="grid-content bg-purple-light">
            <a @click="download">电子保函</a>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <a href="/imgs/bh.jpeg" download>密文电子保函</a>
          </div>
        </el-col>
      </el-row>
    </div>

    <div class="btn">
      <el-button @click="back">返回</el-button>
      <el-button @click="handle" type="primary">审批</el-button>
    </div>

    <el-dialog title="审批" :visible.sync="dialogVisible" width="30%">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="审批结果">
          <el-radio-group v-model="form.status">
            <el-radio label="通过"></el-radio>
            <el-radio label="不通过"></el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="审批备注">
          <el-input type="textarea" v-model="form.desc"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false"
          >确 定</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "Supplier",

  data() {
    return {
      tableData: [
        {
          serialNumber: "1", // 序号
          planCode: "SN45564545665", // 计划编号
          planName: "****公共资源交易中心", // 计划名称
          declareCompany: "***有限公司", // 申报单位
          purchaser: "023535321212454", // 采购商
          status: "待支付", // 状态
          createTime: "25000", // 创建时间
          projectName: "深圳湾一号", // 项目名称
          planTotal: "10000", // 钢材总量计划
          grossArea: "10000", // 建筑面积（M）
        },
        {
          serialNumber: "2", // 序号
          planCode: "SN98645545665", // 计划编号
          planName: "****公共资源交易中心", // 计划名称
          declareCompany: "***有限公司", // 申报单位
          purchaser: "542124478744545", // 采购商
          status: "已取消", // 状态
          createTime: "87000", // 创建时间
          projectName: "深圳湾二号", // 项目名称
          planTotal: "10000", // 钢材总量计划
          grossArea: "12000", // 建筑面积（M）
        },
        {
          serialNumber: "3", // 序号
          planCode: "SN12345545665", // 计划编号
          planName: "****公共资源交易中心", // 计划名称
          declareCompany: "***有限公司", // 申报单位
          purchaser: "545645645645645", // 采购商
          status: "审核中", // 状态
          createTime: "36000", // 创建时间
          projectName: "深圳湾三号", // 项目名称
          planTotal: "17000", // 钢材总量计划
          grossArea: "20000", // 建筑面积（M）
        },
      ],

      showSelected: {},

      serialNumber: "",

      dialogVisible: false,

      form: {
        status: "",
        desc: "",
      },
    };
  },
  mounted() {
    this.serialNumber = this.$route.query.serialNumber || "1";
    const DATA = window.localStorage.getItem("TABLE_DATA") || "";
    if (DATA) {
      this.tableData = JSON.parse(DATA);
    }
    this.tableData.forEach((item) => {
      if (item.serialNumber == this.serialNumber) {
        this.showSelected = item;
        console.log("showSelected", this.showSelected);
      }
    });
  },
  methods: {
    back() {
      this.$router.back();
    },

    handle() {
      this.dialogVisible = true;
    },

    download() {
      this.$download.saveAs("/imgs/dzbh.pdf", "电子保函");
    },
  },
};
</script>
<style scope lang="scss">
.order-container {
  padding: 5% 20% 0;
}
.order-container .btn {
  text-align: center;
  margin-top: 20px;
}
.order-content {
  overflow-y: scroll;
}
.el-row {
  border: 1px solid #ccc;
  border-bottom: 0;
}
.el-row:last-child {
  border: 1px solid #ccc;
}
.el-col {
}
.bg-purple {
  background: rgb(241, 241, 241);
}

.grid-content {
  text-align: left;
  line-height: 36px;
  height: 36px;
  margin-left: 5px;
  a {
    color: blue;
  }
}
.grid-lable {
  text-align: right;
  line-height: 36px;
  height: 36px;
}
</style>
